package basisRouter

import (
	"github.com/Sir-yuChen/funAnalyse/api"
	"github.com/Sir-yuChen/funAnalyse/global"
	"github.com/Sir-yuChen/funAnalyse/middleware"
	"github.com/gin-gonic/gin"
)

type CommonRouter struct{}

func (co *CommonRouter) CommonApiRouter(Router *gin.RouterGroup) {
	commonRouter := Router.Group(global.ROUTER_GROUP_COMMON)
	commonJwtRouter := Router.Group(global.ROUTER_GROUP_COMMON).Use(middleware.JWTAuth()).Use(middleware.CasbinMiddleware())
	commonApi := api.ApiGroupApp.BasisApiGroup.CommonController
	{
		commonRouter.GET(global.API_VERIFICATION.BasePath, middleware.CheckApiResourcesMiddleware(global.API_VERIFICATION), commonApi.GetVerificationCode)
		commonRouter.GET(global.API_CHECVERIFICATION.BasePath, middleware.CheckApiResourcesMiddleware(global.API_CHECVERIFICATION), commonApi.CheckVerificationCode)
	}
	{
		commonJwtRouter.GET(global.API_AUTO_CODE.BasePath, middleware.CheckApiResourcesMiddleware(global.API_AUTO_CODE), commonApi.AutoCode)
		commonJwtRouter.GET(global.API_API_RESOURCE.BasePath, middleware.CheckApiResourcesMiddleware(global.API_API_RESOURCE), commonApi.GetStockApiResource)
		commonJwtRouter.GET(global.API_Table_Structure.BasePath, middleware.CheckApiResourcesMiddleware(global.API_Table_Structure), commonApi.GetStockTableStructure)
	}
}
